//
//  ResidenceSettingCell.m
//  Base_App
//
//  Created by Yutian Duan on 2019/6/10.
//  Copyright © 2019年 Wanwin. All rights reserved.
//

#import "ResidenceSettingCell.h"

@implementation ResidenceSettingCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  if (self) {
    
  }
  return self;
}

- (UILabel *)titleLabel {
  if (!_titleLabel) {
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.textColor = DEF_BLACK;
    _titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.0f];
    _titleLabel.textAlignment = NSTextAlignmentLeft;
    [self.contentView addSubview:_titleLabel];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
      make.leading.mas_equalTo(self.contentView.mas_leading).offset(30);
      make.top.bottom.mas_equalTo(self.contentView);
      make.trailing.mas_equalTo(self.contentView.mas_centerX);
    }];
    
  }
  return _titleLabel;
}

- (UIView *)lineView {
  if (!_lineView) {
    _lineView = [[UIView alloc] init];
    _lineView.backgroundColor = DEF_GRAY;
    [self.contentView addSubview:_lineView];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
      make.leading.mas_equalTo(self.titleLabel.mas_leading);
      make.trailing.mas_equalTo(self.contentView.mas_trailing).offset(-30);
      make.bottom.mas_equalTo(self.contentView.mas_bottom);
      make.height.mas_equalTo(@0.8);
    }];
  }
  return _lineView;
}

- (UILabel *)rightLabel {
  if (!_rightLabel) {
    _rightLabel = [[UILabel alloc] init];
    _rightLabel.textAlignment = NSTextAlignmentRight;
    _rightLabel.textColor = DEF_RED;
    _rightLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:15.0f];
    [self.contentView addSubview:_rightLabel];
    
    [_rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
      make.width.mas_equalTo(@100);
      make.trailing.mas_equalTo(self.lineView.mas_trailing);
      make.top.bottom.mas_equalTo(self.contentView);
    }];
  }
  return _rightLabel;
}

- (UISwitch *)switchButton {
  if (!_switchButton) {
    _switchButton = [[UISwitch alloc] init];
    [self.contentView addSubview:_switchButton];
    
    [_switchButton mas_makeConstraints:^(MASConstraintMaker *make) {
      make.centerY.mas_equalTo(self.contentView);
      make.trailing.mas_equalTo(self.lineView.mas_trailing);
    }];
  }
  return _switchButton;
}

- (UIImageView *)arrwoImage {
  if (!_arrwoImage) {
    _arrwoImage = [[UIImageView alloc] init];
    _arrwoImage.image = [UIImage imageNamed:@""];
    [self.contentView addSubview:_arrwoImage];
    
    ////
    [_arrwoImage mas_makeConstraints:^(MASConstraintMaker *make) {
      make.trailing.mas_equalTo(self.contentView.mas_trailing).offset(30);
      make.centerY.mas_equalTo(self.contentView.mas_centerY);

    }];
  }
  return _arrwoImage;
}



@end
